package com.jackykeke.kdatabasedemo

import java.io.IOException
import java.io.InputStream
import java.io.OutputStream

class FileUtil {

    companion object {
        @Throws(IOException::class)
        fun copy(input: InputStream, output: OutputStream): Int {
            val buffer = ByteArray(1024 * 4)
            var count = 0
            var n = 0
            while (-1 != input.read(buffer).also { n = it }) {
                output.write(buffer, 0, n)
                count += n
            }
            return count
        }

    }
}